package com.yc.testupload.crawler.config;

import java.util.Map;

/**
 * 网站配置类
 * 存储单个网站的抓取配置信息
 */
public class WebsiteConfig {
    private String name; // 网站名称
    private String domain; // 网站域名
    private String urlRegex; // 匹配网站URL的正则表达式
    private Map<String, ChannelConfig> channels; // 网站下的频道配置

    // 构造函数
    public WebsiteConfig(String name, String domain, String urlRegex, Map<String, ChannelConfig> channels) {
        this.name = name;
        this.domain = domain;
        this.urlRegex = urlRegex;
        this.channels = channels;
    }

    // getter和setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getUrlRegex() {
        return urlRegex;
    }

    public void setUrlRegex(String urlRegex) {
        this.urlRegex = urlRegex;
    }

    public Map<String, ChannelConfig> getChannels() {
        return channels;
    }

    public void setChannels(Map<String, ChannelConfig> channels) {
        this.channels = channels;
    }

    /**
     * 根据频道ID获取频道配置
     */
    public ChannelConfig getChannelConfig(String channelId) {
        return channels.get(channelId);
    }
}